package com.apes.fn.business.fixedLoss.modle;

import com.alibaba.fastjson.annotation.JSONField;
import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.ApesConst;
import com.apes.framework.util.DateUtil;
import com.apes.scm.masterdata.frame.model.Dept;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import java.util.Date;

/**
 * @ClassName FixedLossLimitDetail
 * @Author wsj
 * @Date 2021/5/7 18:15
 * @description 定损额度每日变化明细表
 */


@Entity
@Table(name =FixedLossLimitDetail.CONST_TABLE_NAME )
@SelectBeforeUpdate
@Getter
@Setter
@DynamicInsert
@DynamicUpdate
@EntityListeners(DefaultPersistListener.class)
public class FixedLossLimitDetail extends BaseModel {
    public final static String CONST_TABLE_NAME = "Fixed_Loss_Limit_Detail";

    @Id
    @Column(name = "id")
    @ApesGenerator(code = CONST_TABLE_NAME, name = "商务业务策略明细", padding = 5)
    @Comment("明细编码")
    private  String id;


    @JSONField(format = DateUtil.SHOW_DATE_FORMAT)
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "statistic_Date")
    @Comment("统计日期")
    private Date statisticDate;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "dept_id", referencedColumnName = "id")
    @Comment("门店")
    private Dept dept;

    @Column(name = "insurance_Amount", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("车险金额")
    private double insuranceAmount = 0;

    @Column(name = "used_Quota", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("使用定损额度")
    private double quotaUsed = 0;

    @Column(name = "transform_Quota", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("转换定损额度")
    private double transformQuota = 0;

}
